package com.appspot.categoryeditor.utils;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;

public final class IOUtils {

	public static String getStringFromInputStream(InputStream is){
		
		BufferedReader reader  = null;
		StringBuilder sb = new StringBuilder();
		try {
			reader = new BufferedReader(
					new InputStreamReader(is, "UTF-8"));
			sb = new StringBuilder();
			String line;
			while((line = reader.readLine()) != null){
				sb.append(line);
			}
		} catch (IOException e) {
			e.printStackTrace();
		} finally{
			if(reader != null){
				try {
					reader.close();
				} catch (IOException e) {
				}
			}
		}
		
		return sb.toString();
	}	
	
}
